class Player < ActiveRecord::Base
  validates_presence_of     :name
  validates_numericality_of :overall
  validates_presence_of     :position
  validates_format_of       :image_url,
                            :with    => %r{\.(gif|jpg|png)$}i,
                            :message => 'must be a URL for GIF, JPG, or PNG image'
  
  named_scope :quarterbacks,      :conditions => { :position => "QB" }
  named_scope :receivers,         :conditions => { :position => "WR" }
  named_scope :cornerbacks,       :conditions => { :position => "CB" }
  named_scope :defensive_linemen, :conditions => { :position => "DL" }
  named_scope :kickers,           :conditions => { :position => "K"  }
end
  